import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import 'animate.css'

// react-redux 此库便于我们在react组件中操作redux
import { Provider } from 'react-redux'
import store from './store'

// 定义当前应用它的路由模式 BrowserRouter, HashRouter
// react-router-dom@6版本的组件方式编写
import { BrowserRouter as Router } from 'react-router-dom'

// 给原生的String添加一个toSearch方法
String.prototype.toSearch = function () {
  const search = this + ''
  return Object.fromEntries(new URLSearchParams(search).entries())
}

const root = ReactDOM.createRoot(document.getElementById('root'))
root.render(
  <Provider store={store}>
    <Router>
      <App />
    </Router>
  </Provider>
)

export default root
